﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.announcers {
    import Engine.Helpers.*;
    import Classes.*;
    import Classes.sim.*;
    import __AS3__.vec.*;
    import Classes.announcers.announcerinteractions.*;

    public class AnnouncerManager implements IGameWorldStateObserver {

        private var m_world:GameWorld;
        private var m_announcerDataCollection:Vector.<AnnouncerData>;

        public function AnnouncerManager(_arg1:GameWorld){
            var _local3:XML;
            super();
            this.m_world = _arg1;
            _arg1.addObserver(this);
            this.m_announcerDataCollection = new Vector.<AnnouncerData>();
            var _local2:XMLList = Global.gameSettings.getAnnouncers();
            for each (_local3 in _local2) {
                this.m_announcerDataCollection.push(new AnnouncerData(_local3));
            };
        }
        public function scrollToAnnouncer(_arg1:String):void{
            var _local2:AnnouncerData;
            for each (_local2 in this.m_announcerDataCollection) {
                if (_local2.announcerId == _arg1){
                    this.m_world.centerOnObject(_local2.npc);
                    _local2.activateInteraction(AnnouncerInteractionTypes.SCROLL_TO);
                    break;
                };
            };
        }
        public function initialize():void{
        }
        public function cleanUp():void{
        }
        public function onGameLoaded(_arg1:Object):void{
            var _local2:AnnouncerData;
            for each (_local2 in this.m_announcerDataCollection) {
                _local2.hideAnnouncerNPC();
                if (((!(Global.isVisiting())) && (_local2.validate()))){
                    _local2.showAnnouncerNPC();
                };
            };
        }
        public function cycleAllAnnouncers():void{
            var _local1:AnnouncerData;
            for each (_local1 in this.m_announcerDataCollection) {
                if (((((!(Global.isVisiting())) && (_local1.npc))) && (!(_local1.validate())))){
                    _local1.hideAnnouncerNPC(true);
                } else {
                    if (((((!(Global.isVisiting())) && (!(_local1.npc)))) && (_local1.validate()))){
                        _local1.showAnnouncerNPC(true);
                    };
                };
            };
        }
        public function onResourceChange(_arg1:MapResource, _arg2:Vector3, _arg3:Vector3):void{
        }

    }
}//package Classes.announcers 
